package com.mangowang.module.main.adapter;

import android.content.Context;
import android.graphics.Color;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mangowang.lib.common.help.GlideHelper;
import com.mangowang.lib.common.proto.Mystock;
import com.mangowang.lib.common.proto.Transfer;
import com.mangowang.module.main.R;
import com.mangowang.module.main.bean.MachineBean;
import com.ruffian.library.widget.RTextView;

import java.util.List;

public class ShopAdapter extends BaseQuickAdapter<MachineBean, BaseViewHolder> {
    private String type ;
    public ShopAdapter(Context context, List<MachineBean> dataList,String type) {
        super(R.layout.item_shop, dataList);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper,MachineBean item) {
        helper.setText(R.id.tv_name,item.getGoodsInfo())
                .setText(R.id.tv_sn,"SN: "+item.getSnCode())
                .setText(R.id.tv_time,item.getMsg());
        RTextView textView = helper.getView(R.id.tv_ji);
        if(type.equals("1"))
        {
           textView.getHelper().setBackgroundColorNormal(Color.parseColor("#FF4863F0"));
            helper.setBackgroundResource(R.id.rv_root,R.mipmap.shop_bgs_1);
        }else
        { textView.getHelper().setBackgroundColorNormal(Color.parseColor("#FFFF9205"));
            helper.setBackgroundResource(R.id.rv_root,R.mipmap.shop_bgs_2);
        }
        if (item.isSelected())
        {
            helper.setVisible(R.id.iv_select,true);
        }else
        {
            helper.setVisible(R.id.iv_select,false);
        }
    }
}
